package java_basics;

import java.util.Scanner;

/**
 * @author 孤雪唯方
 * @date 2024/07/17
 * @description 商场折扣
 */
public class StoreDiscount {

    /**
     * @param price
     * @return int
     * @description 计算折扣
     */
    public static int calculateDiscount(int price) {
        if (price >= 100&&price < 500)  {
            return price*9/10;
        } else if (price >= 500&&price < 2000)  {
            return price*8/10;
        } else if (price >= 2000&&price < 5000) {
            return price*7/10;
        }else if (price >= 5000) {
            return price*6/10;
        } else {
            return price;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入商品价格：");
        int price = sc.nextInt();
        int discount = calculateDiscount(price);
        System.out.println("折扣后价格：" + discount);
    }
}
